package cn.iocoder.yudao.module.wms.dal.mysql.productionorder;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.controller.admin.pomain.vo.PomainsRespVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.productionorder.ProductionOrderDO;
import cn.iocoder.yudao.module.wms.dal.dataobject.productionorder.ProductionOrdersDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.productionorder.vo.*;

/**
 * 生产任务单主表 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ProductionOrderMapper extends BaseMapperX<ProductionOrderDO> {

    default PageResult<ProductionOrderDO> selectPage(ProductionOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductionOrderDO>()
                .eqIfPresent(ProductionOrderDO::getSerialNumber, reqVO.getSerialNumber())
                .eqIfPresent(ProductionOrderDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(ProductionOrderDO::getOrderDate, reqVO.getOrderDate())
                .eqIfPresent(ProductionOrderDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProductionOrderDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProductionOrderDO::getAuditor, reqVO.getAuditor())
                .orderByDesc(ProductionOrderDO::getId));
    }

    void updateStatus(ProductionOrderDO productionOrderDO);
    ProductionOrderDO findByProcessInstanceId(String processInstanceId);
    List<ProductionOrdersRespVO> findProductionOrdersByPid(Integer pid);

    ProductionOrdersRespVO findProductionOrdersById(Integer id);

    void updateProductionOrders(ProductionOrdersRespVO productionOrdersRespVO);

    List<ProductionOrdersRespVO> findProductionOrdersOperateList(ProductionOrdersDO productionOrdersDO);
    List<ProductionOrderDO> findProductionOrderOperateList();
}